﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YmatouSeller.Notice.Common
{
    public sealed class ConnectionStringHelper
    {
        public static string WriteConnection(string connectionStr = "YmatouSellerinfoWriteConnectionString")
        {
            var connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionStr];

            if (connectionStringSettings == null)
            {
                throw new ConfigurationErrorsException(string.Format("缺少ConnectionString配置{0}", connectionStr));
            }
            string ymtconnection = connectionStringSettings.ConnectionString;
            return ymtconnection;
        }

        public static string ReadConnection(string connectionStr = "YmatouSellerinfoConnectionString")
        {
            var connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionStr];

            if (connectionStringSettings == null)
            {
                throw new ConfigurationErrorsException(string.Format("缺少ConnectionString配置{0}", connectionStr));
            }
            string ymtconnection = connectionStringSettings.ConnectionString;
            return ymtconnection;
        }
    }
}
